//
//  KCSaleAnylseCell.swift
//  MyKC
//
//  Created by yy on 2017/2/22.
//  Copyright © 2017年 com.yasuo. All rights reserved.
//

import UIKit

class KCSaleAnylseCell: UITableViewCell {
    
    @IBOutlet weak var leftView_color: UIView!
    @IBOutlet weak var rightVIew_color: UIView!
    @IBOutlet weak var lbe_reachRate: UILabel!
    @IBOutlet weak var midCircleView: KCCircleView!
    @IBOutlet weak var lbe_estimateSale: UILabel!
    @IBOutlet weak var lbe_actualSale: UILabel!
    @IBOutlet weak var lbe_leftYuan: UILabel!
    
    @IBOutlet weak var lbe_rightYuan: UILabel!
//    //合计指标----计划完成指标
//    var EstimateSales: String?
//    //销量总计---实际完成指标
//    var ActualSales: String?
//    //达成率
//    var ReachRate:String?
    var model: KCHomeProgressModel? {
        //外界已经完成了的赋值
        didSet {
            if ((model?.ActualSales) != nil) {
                lbe_estimateSale.text = Float((model?.EstimateSales) ?? "")! < 0 ? "--" : model?.EstimateSales
                lbe_leftYuan.isHidden = Float((model?.EstimateSales) ?? "")! < 0 ? true : false
                lbe_reachRate.text = Float((model?.ReachRate) ?? "")! < 0 ? "--" : model?.ReachRate
                lbe_actualSale.text = Float((model?.ActualSales) ?? "")! < 0 ? "--" : model?.ActualSales
                lbe_rightYuan.isHidden = Float((model?.ActualSales) ?? "")! < 0 ? true : false
                let reachRate = (model?.ReachRate ?? "") as NSString
                midCircleView.percent = CGFloat(reachRate.floatValue)
            }
        }
    }
    
    override func awakeFromNib() {
        super.awakeFromNib()
        leftView_color.layer.cornerRadius = 7.5
        leftView_color.clipsToBounds = true
        rightVIew_color.layer.cornerRadius = 7.5
        rightVIew_color.clipsToBounds = true
    }

    
}
